﻿using System;
using System.Data;
using System.Collections.Generic;
using ElingOA6_Admin_DSJCJ.Model;
namespace ElingOA6_Admin_DSJCJ.BLL
{
    /// <summary>
    /// ChkInfoStdSuper
    /// </summary>
    public partial class ChkInfoStdSuper
    {
        private readonly ElingOA6_Admin_DSJCJ.DAL.ChkInfoStdSuper dal = new ElingOA6_Admin_DSJCJ.DAL.ChkInfoStdSuper();
        public ChkInfoStdSuper()
        { }
        #region  BasicMethod
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ElingOA6_Admin_DSJCJ.Model.ChkInfoStdSuper GetModel(decimal FYear, string FDeptNo, string FEntityNo, string FInfoClsNo)
        {

            return dal.GetModel(FYear, FDeptNo, FEntityNo, FInfoClsNo);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<ElingOA6_Admin_DSJCJ.Model.ChkInfoStdSuper> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<ElingOA6_Admin_DSJCJ.Model.ChkInfoStdSuper> DataTableToList(DataTable dt)
        {
            List<ElingOA6_Admin_DSJCJ.Model.ChkInfoStdSuper> modelList = new List<ElingOA6_Admin_DSJCJ.Model.ChkInfoStdSuper>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_Admin_DSJCJ.Model.ChkInfoStdSuper model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }
        #endregion  BasicMethod
        #region  自己增加的
        /// <summary>
        /// 获取上级积分定义
        /// <creator>sunlj</creator>
        /// <date>2013-10-24</date>
        /// </summary>
        /// <param name="strEntityNo"></param>
        /// <param name="decYear"></param>
        /// <returns></returns>
        public List<Model.ChkInfoStdSuper> GetListByYear2(string strEntityNo, decimal decYear)
        {
            DataSet ds = dal.GetListByYear2(strEntityNo, decYear);
            return DataTableToListPart(ds.Tables[0]);
        }

        /// <summary>
        /// <creator>sunlj</creator>
        /// <date>2013-10-24</date>
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public List<Model.ChkInfoStdSuper> DataTableToListPart(DataTable dt)
        {
            List<Model.ChkInfoStdSuper> modelList = new List<Model.ChkInfoStdSuper>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Model.ChkInfoStdSuper model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.ChkInfoStdSuper();
                    if (dt.Rows[n]["FBaseScore"].ToString() != "")
                    {
                        model.FBaseScore = decimal.Parse(dt.Rows[n]["FBaseScore"].ToString());
                    }
                    if (dt.Rows[n]["FBaseScore1"].ToString() != "")
                    {
                        model.FBaseScore1 = decimal.Parse(dt.Rows[n]["FBaseScore1"].ToString());
                    }
                    if (dt.Rows[n]["FBaseScore2"].ToString() != "")
                    {
                        model.FBaseScore2 = decimal.Parse(dt.Rows[n]["FBaseScore2"].ToString());
                    }
                    if (dt.Rows[n]["FBaseScore3"].ToString() != "")
                    {
                        model.FBaseScore3 = decimal.Parse(dt.Rows[n]["FBaseScore3"].ToString());
                    }
                    if (dt.Rows[n]["FBaseScore4"].ToString() != "")
                    {
                        model.FBaseScore4 = decimal.Parse(dt.Rows[n]["FBaseScore4"].ToString());
                    }
                    model.FDeptNo = dt.Rows[n]["FDeptNo"].ToString();
                    model.FInfoClsNo = dt.Rows[n]["FInfoClsNo"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }
        #endregion  自己增加的
    }
}

